package main

func isValidSudoku(board [][]byte) bool {
	var rows, colums [9][9]int
	var subboxes [3][3][9]int
	for i, row := range board {
		for j, c := range row {
			if c == '.' {
				continue
			}
			indx := c - '1'
			rows[i][indx]++
			colums[j][indx]++
			subboxes[i/3][j/3][indx]++
			if rows[i][indx] > 1 || colums[j][indx] > 1 || subboxes[i/3][j/3][indx] > 1 {
				return false
			}
		}
	}
	return true

}

//func isValidSudoku2(board [][]byte) bool {
//	var board2 [9][9]byte
//	m := make(map[byte]bool, 9)
//	for i := 0; i < 9; i++ {
//		for j := 0; j < 9; j++ {
//			if m[board2[i][j]] == true || board2[i][j] != '.' {
//				return false
//			} else {
//				m[board2[i][j]] = true
//			}
//		}
//	}
//	return true
//
//}
